package com.example.dao;

import com.example.domain.Contract;
import com.example.domain.Record;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * @author luo
 */
public interface ContractDao {
    /**
     * 查询所有合同打卡信息
     * @return
     */
    @Select("select id, cid, name, stime, etime from contract")
    public List<Contract> selectAllContract();

    /**
     * id查找
     * @param id
     * @return
     */
    @Select("select * from contract where id = #{id}")
    public Contract selectContractById(Integer id);

    /**
     * 模糊查询
     * @param contract
     * @return
     */
//    @Select("select * from employment where position like #{position};")
    public List<Contract> selectContractByName(Contract contract);

    /**
     * 添加信息
     *
     * @param contract
     * @return
     */
    @Insert("insert into contract (cid, name, stime, etime) values (#{cid}, #{name}, #{stime}, #{etime})")
    public int addContract(Contract contract);

    /**
     * 更新信息
     *
     * @param contract
     * @return
     */
    @Update("update contract set cid=#{cid}, name=#{name},stime=#{stime},etime=#{etime} where id=#{id};")
    public int updateContract(Contract contract);

    /**
     * 根据id删除
     * @param id
     * @return
     */
    @Delete("delete from contract where id=#{id};")
    public int deleteContract(Integer id);
}
